package eu.itcsolutions.android.tutorial;
import java.util.ArrayList;
import java.util.List;
import android.app.ListActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;
 
public class SelectieComanda extends ListActivity  {      
    TextView selection;
    public int idToModify;  
    Data dm;
 
    List<String[]> list = new ArrayList<String[]>();
    List<String[]> names2 =null ;
    String[] StringOfOrders;
    protected void onCreate(Bundle savedInstanceState){
        super.onCreate(savedInstanceState);
        setContentView(R.layout.check);
          dm = new Data(this);
          names2 = dm.selectAllOrders();
 
          StringOfOrders=new String[names2.size()];  
 
        int x=0;
        String stg;
 
        for (String[] name : names2) {
            stg = name[1]+" - "+name[2]+ " - "+name[3];
 
            StringOfOrders[x]=stg;
            x++;
        }
 
 
        ArrayAdapter<String> adapter = new ArrayAdapter<String>(    
                this,android.R.layout.simple_list_item_1,    
                StringOfOrders);
        this.setListAdapter(adapter);
        selection=(TextView)findViewById(R.id.selection);
 
    }       
 
    public void onListItemClick(ListView parent, View v, int position, long id) {
        selection.setText(StringOfOrders[position]);
    }
 
 
}

